﻿
namespace Sai.Core.Reporting
{
    using System.Text;

    public class ClassicReportStyler : IReportStyler
    {
        public ClassicReportStyler()
        {
            var styleBuilder = new StringBuilder();

            styleBuilder.AppendLine("html,body,div,h1,h2,h3,h4,h5,h6,p,img,dl,dt,dd,ol,ul,li,table,caption,tbody,tfoot,thead,tr,th,td,form,fieldset,embed,object,applet { margin: 0; padding: 0; border: 0; }");

            styleBuilder.AppendLine("html, body { background-color:#fff; }");
            styleBuilder.AppendLine("body { font-family:helvetica,arial,sans-serif; font-size:13px; color:#333; }");

            styleBuilder.AppendLine("header { margin-bottom: 0; }");
            styleBuilder.AppendLine("header > hgroup { background-color: #3c8dc5; color:#fff; padding: 1em; }");

            styleBuilder.AppendLine("section > p, nav { padding: 1em; color: #fff; background-color: #6fb7e9}");
            styleBuilder.AppendLine("section, nav { margin-bottom: 2em; }");

            styleBuilder.AppendLine("article { padding: 1em; }");

            styleBuilder.AppendLine("table { border-collapse:collapse; border-width:0; empty-cells:show; font-size:1em; margin:0 0 1em; padding:0; width: 100%; }");
            styleBuilder.AppendLine("th, td { border: 1px solid #ccc; padding:6px 12px; text-align:left; vertical-align:top; background-color:inherit; }");
            styleBuilder.AppendLine("th { background-color: #b2d1e5; }");
            styleBuilder.AppendLine("td > p:last-child { margin:0; }");
            styleBuilder.AppendLine(".even { background-color: #e9f2f9; }");
            styleBuilder.AppendLine("caption { display: none; }");
            styleBuilder.AppendLine("code { font-family: consolas, courier, monospace; }");

            styleBuilder.AppendLine("a:link { color: #3c8dc5; text-decoration: none; }");
            styleBuilder.AppendLine("a:visited { color: #3c8dc5; }");
            styleBuilder.AppendLine("a:hover { text-decoration:underline; }");
            styleBuilder.AppendLine("a:active { text-decoration:underline; }");

            styleBuilder.AppendLine("footer > p { text-align: center; }");
            styleBuilder.AppendLine("footer { border-top: 1px solid #ccc; background-color: #eee; padding: 0 1em 2em 0; }");

            styleBuilder.AppendLine("nav { margin: 0; }");
            styleBuilder.AppendLine("nav a:link, nav a:visited { color: #fff; }");
            styleBuilder.AppendLine("ul, li { display: inline; margin-right: 0.5em; }");

            styleBuilder.AppendLine("footer > nav { background-color: #eee; color: #3c8dc5; }");
            styleBuilder.AppendLine("footer > nav a:link, footer > nav a:visited { color: #3c8dc5; }");

            styleBuilder.AppendLine(".kw { color: #00f; margin-left: 0.2em; margin-right: 0.2em; }");
            styleBuilder.AppendLine(".tn { color: #2b91af; padding-left: 0.2em; padding-right: 0.2em; }");
            styleBuilder.AppendLine(".punc { color: black; }");
            styleBuilder.AppendLine(".ident { color: black; padding-left: 0.2em; padding-right: 0.2em; }");

            //styleBuilder.AppendLine("h1 { margin: 0em; margin-bottom: 0.5em; }");
            //styleBuilder.AppendLine("h2 { text-align: left; font-size: 1.0em; margin-bottom: 1em;  }");

            this.StyleTag = styleBuilder.ToString();
        }

        public string HeadTag
        {
            get;
            set;
        }

        public string StyleTag
        {
            get;
            set;
        }

        public string HeadingText
        {
            get;
            set;
        }

        public string FooterText
        {
            get;
            set;
        }

        public bool IsValid
        {
            get { return true; }
        }
    }
}
